package com.mob.commons.logcollector;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Base64;
import com.mob.tools.MobLog;
import com.mob.tools.log.NLog;
import java.util.ArrayList;
import java.util.HashMap;

public class f
{
  public static long a(Context paramContext, long paramLong, String paramString1, int paramInt, String paramString2)
  {
    try
    {
      boolean bool = TextUtils.isEmpty(paramString1);
      if (bool);
      long l1;
      for (long l2 = -1L; ; l2 = l1)
      {
        return l2;
        b localb = b.a(paramContext);
        ContentValues localContentValues = new ContentValues();
        localContentValues.put("exception_time", Long.valueOf(paramLong));
        localContentValues.put("exception_msg", paramString1.toString());
        localContentValues.put("exception_level", Integer.valueOf(paramInt));
        localContentValues.put("exception_md5", paramString2);
        l1 = localb.a("table_exception", localContentValues);
      }
    }
    finally
    {
    }
  }

  public static long a(Context paramContext, ArrayList<String> paramArrayList)
  {
    long l;
    if (paramArrayList == null)
      l = 0L;
    while (true)
    {
      return l;
      try
      {
        StringBuilder localStringBuilder = new StringBuilder();
        for (int i = 0; i < paramArrayList.size(); i++)
        {
          localStringBuilder.append("'");
          localStringBuilder.append((String)paramArrayList.get(i));
          localStringBuilder.append("'");
          localStringBuilder.append(",");
        }
        String str = localStringBuilder.toString().substring(0, -1 + localStringBuilder.length());
        int j = b.a(paramContext).a("table_exception", "exception_md5 in ( " + str + " )", null);
        NLog localNLog = MobLog.getInstance();
        Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = Integer.valueOf(j);
        localNLog.i("delete COUNT == %s", arrayOfObject);
        l = j;
      }
      finally
      {
      }
    }
  }

  private static ArrayList<e> a(Context paramContext, String paramString, String[] paramArrayOfString)
  {
    try
    {
      ArrayList localArrayList = new ArrayList();
      e locale = new e();
      b localb = b.a(paramContext);
      String str = " select exception_md5, exception_level, exception_time, exception_msg, sum(exception_counts) from table_exception group by exception_md5 having max(_id)";
      if ((!TextUtils.isEmpty(paramString)) && (paramArrayOfString != null) && (paramArrayOfString.length > 0))
        str = " select exception_md5, exception_level, exception_time, exception_msg, sum(exception_counts) from table_exception where " + paramString + " group by exception_md5 having max(_id)";
      Cursor localCursor = localb.a(str, paramArrayOfString);
      while ((localCursor != null) && (localCursor.moveToNext()))
      {
        locale.b.add(localCursor.getString(0));
        HashMap localHashMap = new HashMap();
        localHashMap.put("type", Integer.valueOf(localCursor.getInt(1)));
        localHashMap.put("errat", Long.valueOf(localCursor.getLong(2)));
        localHashMap.put("msg", Base64.encodeToString(localCursor.getString(3).getBytes(), 2));
        localHashMap.put("times", Integer.valueOf(localCursor.getInt(4)));
        locale.a.add(localHashMap);
        if (locale.b.size() == 50)
        {
          localArrayList.add(locale);
          locale = new e();
        }
      }
      localCursor.close();
      if (locale.b.size() != 0)
        localArrayList.add(locale);
      return localArrayList;
    }
    finally
    {
    }
  }

  public static ArrayList<e> a(Context paramContext, String[] paramArrayOfString)
  {
    String str = "exception_level = ?";
    if (paramArrayOfString != null);
    while (true)
    {
      try
      {
        if (paramArrayOfString.length > 0)
        {
          if (b.a(paramContext).a("table_exception") > 0)
          {
            ArrayList localArrayList2 = a(paramContext, str, paramArrayOfString);
            localArrayList1 = localArrayList2;
            return localArrayList1;
          }
          ArrayList localArrayList1 = new ArrayList();
          continue;
        }
      }
      finally
      {
      }
      str = null;
      paramArrayOfString = null;
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.mob.commons.logcollector.f
 * JD-Core Version:    0.6.2
 */